package api_model

import (
	"time"
)

func CreateMerchantBalanceLogFactory(sqlType string) *MerchantBalanceLog {
	return &MerchantBalanceLog{BaseModel: BaseModel{DB: UseDbConn(sqlType)}}
}

type MerchantBalanceLog struct {
	BaseModel
	Id            int32     `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"`
	MerchantId    int32     `gorm:"column:merchant_id;NOT NULL;comment:'商家id'"`
	LevelId       int32     `gorm:"column:level_id;default:NULL;comment:'当时等级'"`
	Balance       float64   `gorm:"column:balance;NOT NULL;comment:'剩余（用户经过此次流水后账户的余额）'"`
	FreezeBalance float64   `gorm:"column:freeze_balance;default:0.00;NOT NULL;comment:'冻结金额（本次流水后的冻结金额）'"`
	Money         float64   `gorm:"column:money;NOT NULL;comment:'金额'"`
	Type          int8      `gorm:"column:type;NOT NULL;comment:'0 收入 1支出'"`
	Source        int8      `gorm:"column:source;NOT NULL;comment:'变更来源 1 分佣奖励  2 发布任务扣除 3充值 4 提现 5 礼品代发购买 6 补差价 7 照妖镜验号 8扣除本金 9 扣除佣金 10 取消订单退还'"`
	Remark        string    `gorm:"column:remark;default:NULL;comment:'备注'"`
	OrderSn       string    `gorm:"column:order_sn;default:NULL;comment:'关联订单id/充值/分佣id'"`
	CreateTime    time.Time `gorm:"column:create_time;default:CURRENT_TIMESTAMP;NOT NULL"`
}

func (m *MerchantBalanceLog) TableName() string {
	return "merchant_balance_log"
}
